/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pio.action.administrador.carreras;

import DBMS.DataBaseManager;
import clases.Carrera;
import clases.Coordinador;
import clases.Institucion;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author chino
 */
public class Eliminar extends Action {
    
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        Carrera c = (Carrera) form;
        DataBaseManager dbms = DataBaseManager.getInstance();
        boolean eliminado = dbms.eliminarCarrera(c);
        if (eliminado) {
            c.setMensaje("Carrera eliminada exitosamente.");
            return mapping.findForward("success");
        } else {            
            c.setMensaje("No se pudo eliminar la carrera.");
            return mapping.findForward("failure");
        }
    }
}
